@extends('layouts.default') @section('main')
    <link rel="stylesheet" href="/css/uniform.css"/>
    <link rel="stylesheet" href="/css/select2.css"/>
    <div id="content">
        <div id="content-header">
            <div id="breadcrumb">
                <a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i
                            class="icon-home"></i> 首页</a> <a href="#" class="current">角色管理</a>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <form action="{{url('role/menu')}}" method="post">
                    <div class="span12">
                        <div class="widget-box">
                            <div class="widget-title">
                                <span class="icon"><i class="icon-th"></i></span>
                                <h5>栏目分配</h5>
                            </div>
                            <div class="widget-content">
                                <table class="table table-bordered table-striped with-check">
                                    <thead>
                                    <tr>
                                        <th><input type="checkbox" id="title-table-checkbox"
                                                   name="title-table-checkbox"/></th>
                                        <th>栏目名称</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    @foreach($controllers as $key => $controller)
                                        @if(in_array($controller['submodule_id'], $submodules))
                                        <tr>
                                            <td><input type="checkbox" name="cid[]" value="{{$controller['id']}}" {{$controller['got']}} /></td>
                                            <td>{{$controller['name']}}</td>
                                        </tr>
                                            @foreach($controller['children'] as $k => $c)
                                                <tr>
                                                    <td><input type="checkbox" name="cid[]" value="{{$c['id']}}" {{$c['got']}} /></td>
                                                    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--{{$c['name']}}
                                                            @foreach($c['actions'] as $k_action => $action)
                                                                <input type="checkbox" name="aid[]" value="{{$action['id']}}" {{$action['got']}} />{{$action['name']}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                            @endforeach
                                                    </td>
                                                </tr>
                                                @foreach($c['children'] as $k=>$v)
                                                    <tr>
                                                        <td><input type="checkbox" name="cid[]" value="{{$v['id']}}" {{$v['got']}} /></td>
                                                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--{{$v['name']}}
                                                            @foreach($v['actions'] as $v_action => $vaction)
                                                                <input type="checkbox" name="aid[]" value="{{$vaction['id']}}" {{$vaction['got']}} />{{$vaction['name']}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                            @endforeach
                                                        </td>
                                                    </tr>
                                                @endforeach
                                            @endforeach
                                        @endif
                                    @endforeach
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <input type="hidden" name="_token" value="{{ csrf_token() }}">
                        <input type="hidden" name="role_id" value="{{$role_id}}">
                        <button class="btn" type="submit">提交</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script src="/js/jquery.min.js"></script>
    <script src="/js/matrix.tables.js"></script>
@stop
